package hapi.store;

import java.sql.*;

public class DBconnection {

	private static Connection con = null;

	public static void connect() {
		try {
			Class.forName("oracle.jdbc.driver.OracleDriver");

			con = DriverManager.getConnection(
					"jdbc:oracle:thin:@OEL5U4-DB11GR2.DI.UMINHO.PT:1521:kitik",
					"SI201201", "SI201201");

			System.out.println("Connect");

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void execute_query(String sql_code) {
		Statement s;
		try {
			s = con.createStatement();
			s.execute(sql_code);
			s.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public static void close_connection() {
		try {
			con.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

}
